document.getElementById('goods_img').addEventListener('change', function(e) {
    var file = e.target.files[0];
    var reader = new FileReader();

    reader.onload = function(e) {
        var img = document.createElement('img');
        img.src = e.target.result;
        document.getElementById('preview').innerHTML = '';
        document.getElementById('preview').appendChild(img);
        document.getElementById('preview').style.display = 'block';
    };

    reader.readAsDataURL(file);
});